//
//  PKRadioDetailHeaderView.m
//  PianKe
//
//  Created by luojinrong11 on 15/10/4.
//  Copyright (c) 2015年 lanou. All rights reserved.
//

#import "PKRadioDetailHeaderView.h"
#import <UIImageView+WebCache.h>
#import <UIButton+WebCache.h>
@implementation PKRadioDetailHeaderView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/



#warning 初始化tableView的头视图
-(instancetype)initWithFrame:(CGRect)frame
{

    self=[super initWithFrame:frame];
    if (self) {
        _coverimg=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 180)];
        [self addSubview:_coverimg];
        _peopleIcon=[UIButton buttonWithType:UIButtonTypeCustom];
        _peopleIcon.frame=CGRectMake(30, 190, 30, 30) ;
        [_peopleIcon.imageView.layer setCornerRadius:15];
        [self addSubview:_peopleIcon];
        _unameButton=[UIButton buttonWithType:UIButtonTypeSystem];
        _unameButton.frame=CGRectMake(65, 190, 150, 30);
//        _unameButton.font=[UIFont systemFontOfSize:12];
        _unameButton.titleLabel.font=[UIFont systemFontOfSize:12];
        _unameButton.contentHorizontalAlignment=UIControlContentHorizontalAlignmentLeft;
        [self addSubview:_unameButton];
        _musicvisitnum=[[UILabel alloc]initWithFrame:CGRectMake(300, 200, 60, 30)];
        _musicvisitnum.font=[UIFont systemFontOfSize:13];
        [self addSubview:_musicvisitnum];
        _descLable=[[UILabel alloc]initWithFrame:CGRectMake(30, 240, 300, 40)];
        _descLable.font=[UIFont systemFontOfSize:16];
        [self addSubview:_descLable];
        
        
    }
    return self;
}
#warning 通过在控制器里面解析数据的方法里面初始化
-(void)setRadioInfo:(PKRadioInfo *)radioInfo

{ 
    _radioInfo=radioInfo;
    [self.coverimg sd_setImageWithURL:[NSURL URLWithString:radioInfo.coverimg]];
//    [self.peopleIcon setImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:radioInfo.userinfo[@"icon"]]] ]forState:UIControlStateNormal];
    [self.peopleIcon sd_setImageWithURL:[NSURL URLWithString:radioInfo.userinfo.icon] forState:UIControlStateNormal];
    [self.unameButton setTitle:radioInfo.userinfo.uname forState:UIControlStateNormal] ;
    self.musicvisitnum.text=[NSString stringWithFormat:@"%ld",radioInfo.musicvisitnum];
    self.descLable.text=radioInfo.desc;
}
@end
